<template>
  <div class="home">
    <el-container>
      <el-header>
        <el-menu mode="horizontal" :default-active="activeIndex" @select="handleSelect">
          <el-menu-item index="0">配置中心</el-menu-item>
          <el-menu-item index="6">数据统计</el-menu-item>
          <el-menu-item index="1">客户管理</el-menu-item>
          <el-menu-item index="2">账户管理</el-menu-item>
          <el-menu-item index="3">邮件推送</el-menu-item>
          <el-menu-item index="4">短信推送</el-menu-item>
          <el-menu-item index="5">IP资源池</el-menu-item>
        </el-menu>
      </el-header>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </div>
</template>

<script>
export default {
  name: "home",
  data() {
    return {
      activeIndex: "0"
    };
  },
  provide() {
    return {
      reload: this.reload
    };
  },
  methods: {
    handleSelect(key) {
      let _this = this;
      if (key === "0") {
        _this.$router.push({ path: "/" });
      }
      if (key === "1") {
        _this.$router.push({ path: "customer" });
      }
      if (key === "2") {
        _this.$router.push({ path: "logos" });
      }
      if (key === "3") {
        _this.$router.push({ path: "emails" });
      }
      if (key === "4") {
        _this.$router.push({ path: "message" });
      }
      if (key === "5") {
        _this.$router.push({ path: "ips" });
      }
      if (key === "6") {
        _this.$router.push({ path: "sum" });
      }
    },
    reload() {
      this.isRouterAlive = false;
      this.$nextTick(function() {
        this.isRouterAlive = true;
      });
    }
  }
};
</script>

<style lang='scss'>
@import "./index.scss";
</style>
